#pragma once
#include <string>
#include <logger.h>

class LogFac
{
private:
    Logger logger_;

private:
    LogFac() {};
    void config(const std::string &conf_file);

public:
    void Init(const std::string &conf_file = "log.conf");
    Logger &logger() { return logger_; }
    static LogFac &Instance();
};

#define LOGOUT(l, s) LogFac::Instance().logger().Write(l, s, __FILE__, __LINE__);
#define LOGDEBUG(s) LOGOUT(XLog::DEBUG, s)
#define LOGINFO(s) LOGOUT(XLog::INFO, s)
#define LOGERROR(s) LOGOUT(XLog::ERROR, s)
#define LOGFATAL(s) LOGOUT(XLog::FATAL, s)